package com.dingwen.treasure.model.entity.jpa;

import com.dingwen.treasure.base.enums.ExecuteResultEnum;
import io.github.classgraph.json.Id;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 定时任务日志： 实体
 *
 * @author dingwen
 * @date 2022/05/09
 */
@Getter
@Setter
@Builder
@DynamicUpdate
@DynamicInsert
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Entity(name = "quartz_log")
public class QuartzLog implements Serializable {

    private static final long serialVersionUID = -5824849127123148284L;

    /**
     * 主键
     * GenerationType.IDENTITY ： 数据库自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @javax.persistence.Id
    @Column(name = "id", nullable = false)
    private Long id;


    /**
     * 定时任务ID
     */
    private Long quartzId;


    /**
     * 激活时间
     */
    private LocalDateTime activateTime;

    /**
     * 任务耗时： 毫秒
     */
    private Long consumerTime;


    /**
     * 执行结果
     */
    @Column(name = "execute_result")
    @Enumerated(EnumType.ORDINAL)
    private ExecuteResultEnum executeResult;

    /**
     * 备注
     */
    private String remark;
}
